package com.uniview.dto;


import java.io.Serializable;

/**
 * created by lux
 */
public class RespDTO<T> implements Serializable {

    public String code = "0";
    public String error = "";
    public int status = 200;
    public T data;

    public static RespDTO onSuc(Object data) {
        RespDTO resp = new RespDTO();
        resp.data = data;
        return resp;
    }

    public static RespDTO onSuc(Object data, int status) {
        RespDTO resp = new RespDTO();
        resp.data = data;
        resp.status = status;
        return resp;
    }

    @Override
    public String toString() {
        return "RespDTO{" +
                "code=" + code +
                ", error='" + error + '\'' +
                ", data=" + data +
                '}';
    }

    public void setCode(String code) {
        this.code = code;
    }

    public void setError(String error) {
        this.error = error;
    }

    public void setStatus(int status) {
        this.status = status;
    }
}
